# 1021 简单：删除最外层的括号

def removeOuterParentheses(s):
    primit = []
    num = 0
    for c in s:
        if c == '(':
            num += 1
            if num > 1:
                primit.append(c)
        else:
            num -= 1
            if num > 0:
                primit.append(c)
    return ''.join(primit)


print(removeOuterParentheses("(()())(())"))
